/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package view;

import java.awt.Graphics;
import java.awt.Image;
import java.net.URL;
import javax.swing.ImageIcon;

/**
 *
 * @author Pioli
 */
public class InicialPanel extends javax.swing.JPanel {

    private Image bgImage;
    
    /**
     * Creates new form InicialPanel
     */
    public InicialPanel() {
        initComponents();
        
        //hace transparente al panel
        this.setOpaque(false);
        
        //le pone la imagen de fondo
        this.setBackgroundImage(this.createImage("/assets/main_page.png").getImage());
    }
    
    private ImageIcon createImage(String path) {
    URL imgURL = getClass().getResource(path);
        if (imgURL != null) {
            return new ImageIcon(imgURL);
        } else {
            System.err.println("Couldn't find file: " + path);
            return null;
        }
    }
    private void setBackgroundImage(Image bgImage) {
        this.bgImage = bgImage;
    }
    @Override
    public void paint(Graphics g) {

        // Pintamos la imagen de fondo...
        if(bgImage != null) {
           g.drawImage(bgImage, 0, 0, null);
        }

        // Y pintamos el resto de cosas que pueda tener el panel
        super.paint(g);

    }
    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        Barra2 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        jLabel4 = new javax.swing.JLabel();
        jButton1 = new javax.swing.JButton();
        Barra1 = new javax.swing.JPanel();
        jLabel2 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        placeHolder = new javax.swing.JPanel();

        setOpaque(false);
        setLayout(new org.netbeans.lib.awtextra.AbsoluteLayout());

        Barra2.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jLabel1.setText("Notificaciones:");

        jLabel4.setText("Nuevos turnos de examenes creados! Click en el boton para modificar las fechas");

        jButton1.setText("Modificar Fechas");

        javax.swing.GroupLayout Barra2Layout = new javax.swing.GroupLayout(Barra2);
        Barra2.setLayout(Barra2Layout);
        Barra2Layout.setHorizontalGroup(
            Barra2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(Barra2Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(Barra2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(Barra2Layout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(jLabel4)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                        .addComponent(jButton1))
                    .addComponent(jLabel1))
                .addContainerGap(130, Short.MAX_VALUE))
        );
        Barra2Layout.setVerticalGroup(
            Barra2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(Barra2Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel1)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(Barra2Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel4)
                    .addComponent(jButton1))
                .addContainerGap(119, Short.MAX_VALUE))
        );

        Barra2.setVisible(false);
        add(Barra2, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 450, -1, -1));

        Barra1.setBorder(javax.swing.BorderFactory.createEtchedBorder());

        jLabel2.setText("Sesion iniciada:");

        jLabel3.setText("Nombre: Perez Juan");

        javax.swing.GroupLayout Barra1Layout = new javax.swing.GroupLayout(Barra1);
        Barra1.setLayout(Barra1Layout);
        Barra1Layout.setHorizontalGroup(
            Barra1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(Barra1Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(Barra1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(Barra1Layout.createSequentialGroup()
                        .addGap(10, 10, 10)
                        .addComponent(jLabel3))
                    .addComponent(jLabel2))
                .addContainerGap(541, Short.MAX_VALUE))
        );
        Barra1Layout.setVerticalGroup(
            Barra1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(Barra1Layout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jLabel2)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jLabel3)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        Barra1.setVisible(false);
        add(Barra1, new org.netbeans.lib.awtextra.AbsoluteConstraints(10, 380, 662, -1));

        placeHolder.setPreferredSize(new java.awt.Dimension(500, 1850));
        placeHolder.setLayout(new javax.swing.BoxLayout(placeHolder, javax.swing.BoxLayout.LINE_AXIS));
        placeHolder.setVisible(false);
        add(placeHolder, new org.netbeans.lib.awtextra.AbsoluteConstraints(-70, 380, 808, 260));
    }// </editor-fold>//GEN-END:initComponents
    // Variables declaration - do not modify//GEN-BEGIN:variables
    public javax.swing.JPanel Barra1;
    public javax.swing.JPanel Barra2;
    private javax.swing.JButton jButton1;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    public javax.swing.JPanel placeHolder;
    // End of variables declaration//GEN-END:variables
}
